"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var carousel_1 = require("ngx-bootstrap/carousel");
var api_1 = require("../../../config/api");
var local_storage_service_1 = require("../../lib/service/local-storage.service");
var Index2Component = /** @class */ (function () {
    function Index2Component(httpService, router, localStorageService) {
        this.httpService = httpService;
        this.router = router;
        this.localStorageService = localStorageService;
        this.isShow = false;
        this.aliyunOssOutputUrl = api_1.AliyunOssOutputUrl;
    }
    Index2Component.prototype.ngOnInit = function () {
        this.getArtical();
    };
    //获取最新资讯
    Index2Component.prototype.getArtical = function () {
        var _this = this;
        var url = api_1.adSystemApiUrl + "/v1/fddata/posts/list";
        return this.httpService.httpGetAuth(url).subscribe(function (data) {
            _this.newestInfo = data.data.data;
        });
    };
    // 点击轮播图跳转页面
    Index2Component.prototype.turnPage = function () {
        var auth = this.localStorageService.getUserInfo();
        if (!auth) {
            this.type = 'info';
            this.message = '请先登录';
            this.isShow = true;
            return false;
        }
        this.router.navigate(['/main/index']);
    };
    // 跳转到新闻详情页
    Index2Component.prototype.turnNewsDetail = function (data) {
        this.router.navigate(['/home/news-detail/' + data.id], { queryParams: { categoryId: data.category_id } });
    };
    Index2Component = __decorate([
        core_1.Component({
            selector: 'app-index',
            templateUrl: './index.component.html',
            styleUrls: ['./index.component.scss'],
            providers: [{ provide: carousel_1.CarouselConfig, useValue: { interval: 5000, noPause: true } }, local_storage_service_1.LocalStorageService]
        })
    ], Index2Component);
    return Index2Component;
}());
exports.Index2Component = Index2Component;
